class AA {
	def c() {
		println this
		{-> println this; this } //clousure Object
		// this is Class AA
	 }
}

class BB {
	def f(c) { println this; c()} // this is Class BB
	// c() is Class AA
}

a = new AA();
c = a.c()

assert a != c // clousure Object
assert a == c() // Class AA

b = new BB()

b.f c

def foo(n) { {i -> n += i; println n}}

f = foo(100) // get clousure, & n = 100
f(1) // call clousure i = 1
f(2) // call clousure i = 2 statck before statement result

g = foo(10) // get new clousure & n = 10
g(1)
g(1)


def f(x, y, z) { println x; println y; println z(1) }

//f(1,2,3)

f(1, 2, {a -> a + 2})

f(1, 2) { a -> a + 2 }

for (i in 1..10) {if (i == 5) { println "end at $i"; break; } }
